package com.chinackts.auth.model;

import lombok.Data;

import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author Lianhong
 * @since 2021/2/24
 * 代理IP （四叶天）
 */
@Data
public class ProxyIP_SYT implements Serializable {

    private String code;
    private String info;
    private List<ItemData> data;

    public ProxyIP convert() {
        return new ProxyIP(
                ProxyType.QG,
                this,
                this.data.stream().map(item -> new ProxyIP.Item(item.ip, item.port, item.end_time)).collect(Collectors.toList())
        );
    }

    @Data
    public static class ItemData implements Serializable {

        private String ip;
        private Integer port;
        private String end_time;
    }
}
